﻿@using NewLife.Common;
@using NewLife.Cube.WebMiddleware;
@using NewLife.Cube.Charts;
@{
    Layout = null;

    var user = ViewBag.User as IUser ?? User.Identity as IUser;
    var roleNames = "";
    if (user != null) roleNames = user.Roles == null ? "" : user.Roles.Join();

    var title = ViewBag.Title + "";
    if (title != "" && !title.Contains(" - "))
    {
        title += " - " + NewLife.Common.SysConfig.Current.DisplayName;
    }

    var set = NewLife.Cube.Setting.Current;
    var res = set.ResourceUrl;
    if (String.IsNullOrEmpty(res)) res = "/Content";
    res = res.TrimEnd('/');

    var set2 = ViewBag.PageSetting as PageSetting;

    var menu = ViewBag.Menu as IMenu;
    if (menu == null) menu = Context.Items["CurrentMenu"] as IMenu;

    var runInfo = !set.ShowRunTime ? "" : RunTimeMiddleware.GetInfo(this.Context);
}
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->

    <title>@title</title>
    <link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />

    <!-- 页面内联样式 -->
    @RenderSection("css", required: false)

    <link href="@res/elementui/css/element.css" rel="stylesheet" />
    <link href="@res/elementui/css/layout.css" rel="stylesheet" />
    <!-- jQuery -->
    <script src="@res/js/jquery-3.6.0.min.js"></script>
    <style>
        .main-footer {
            padding: 16px;
            background-color: #ecf8ff;
            border-radius: 4px;
            border-left: 5px solid #50bfff;
            margin: 20px 0;
        }
    </style>
</head>
<body>
    <div id="app">

        @if (set2 != null && set2.EnableNavbar)
        {

            @await Html.PartialAsync("_Layout_Nav")

        }


        @RenderBody()

        @if (set.ShowRunTime)
        {
            <!-- /.content-wrapper -->
        <footer class="main-footer">
            @Html.Raw(runInfo)
        </footer>
        }
    </div>

    <!-- ElementUI -->
    <script src="@res/elementui/js/moment.min.js"></script>
    <script src="@res/elementui/js/axios.min.js"></script>
    <script src="@res/elementui/js/vue.min.js"></script>
    <script src="@res/elementui/js/element.min.js"></script>

    @RenderSection("scripts", required: false)
</body>
</html>